package com.aopeng.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @author 谢辉
 * @description 网站图片实体类
 * @data 2020/7/15
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "aopeng_picture")
public class AopengPicture {

    @TableId(value = "id",type = IdType.AUTO)   //指定id并设置为自增
    private Long id;
    private String pictureAddress;                 //图片地址
    private String pictureName;                    //图片名称
    private Integer pictureType;                    //图片类型 ：1、Logo 2、二维码 3、首页图标 4、底部插图  5、导航背景图 6、头像
    private String pictureDescr;                   //备注说明
    private String linkAddress;                    //链接地址
    //字段填充内容
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;                    //创建时间
    private Long creator;                       //创建人
    //字段填充内容
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;                    //修改时间
    private Long updater;                       //修改人
    private Integer isDelete;                   //是否删除  1.未删除  2.已删除

    public AopengPicture(Long id,String pictureAddress, String pictureName, Integer pictureType, String pictureDescr, String linkAddress, Long creator, Long updater, Integer isDelete) {
        this.id = id;
        this.pictureAddress = pictureAddress;
        this.pictureName = pictureName;
        this.pictureType = pictureType;
        this.pictureDescr = pictureDescr;
        this.linkAddress = linkAddress;
        this.creator = creator;
        this.updater = updater;
        this.isDelete = isDelete;
    }

    public AopengPicture(String pictureAddress, String pictureName, Integer pictureType, String pictureDescr, String linkAddress, Long creator, Long updater, Integer isDelete) {
        this.pictureAddress = pictureAddress;
        this.pictureName = pictureName;
        this.pictureType = pictureType;
        this.pictureDescr = pictureDescr;
        this.linkAddress = linkAddress;
        this.creator = creator;
        this.updater = updater;
        this.isDelete = isDelete;
    }

    public String getPictureTypeName(){
        if (pictureType==1){
            return "公司LOGO";
        }else if(pictureType==2){
            return "二维码";
        }else if(pictureType==3){
            return "首页图标";
        }else if(pictureType==4){
            return "底部插图";
        }else if(pictureType==5){
            return "导航背景图";
        }else if(pictureType==6){
            return "头像";
        }

        return "";
    }
}
